/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Application.MainForm;
import java.awt.*;
import Application.Elements.LED;
/**
 * A LED osztaly megjeleniteseert felelos osztaly
 * @author Stikmann
 */
public class LEDControl extends Canvas{
    private LED led;
    
    public LEDControl(LED aled){
        super();
        led=aled;
        setSize(35,35);
    }

    /**
     * Ujrarajzolaskor hivja meg a java ezt a fuggvenyt
     * @param g
     */
    @Override
    public void paint(Graphics g){
        if (led.getOut())
            g.setColor(Color.red);
        else
            g.setColor(Color.black);
        g.fillOval(0,0,35,35);
    }

    /**
     * Ervenyteleniteskor hivja meg a java a fuggvenyt, ami jelen esetben ujra
     * is rajzoltatja a controlt.
     */
    @Override
    public void invalidate(){
        super.invalidate();
        this.repaint();
    }
}
